<?php
class Henry_Users extends Zend_Db_Table_Abstract
{
	static private $TBNAME = "users";
	protected $_name = ''; 
  	protected $_primary = 'id';
	public function __construct() {
        parent::__construct();
        $dbconfig = $this->_db->getConfig();
        $this->_name = $dbconfig['prefix'].'users';
    }
	public function changePass($user,$newPas)
	{
		
		$where = $this->_db->quoteInto("user =? ", $user);
		$data = array(
			'password' => md5(sha1($newPas))
		);
		return $this->update($data, $where);
		//Get current Status;
	}
	public function isPassOk($user,$pass)
	{
		$select = $this->_db->select();
		$select->from($this->_name,array('user'))
				->where("user = ?",$user)
				->where("password = ?",md5(sha1($pass)));
		$data = $this->_db->fetchOne($select);
		if (empty($data))
			return false;
		return true;					
	}
}